package code.ws_common_net.support
{
	
	import flash.utils.Dictionary;
	import code.ws_common_interface.support.IDataPacket;
	import code.ws_common_interface.support.IResponsePool;
	import code.ws_common_net.code.ReceivedPacket;
	
	public class ResponsePool implements IResponsePool
	{
		protected var responPool:Dictionary=new Dictionary();
		public function ResponsePool()
		{
		}
		
		public function addResponse(key:uint, data:Class):void
		{
			if(responPool[key]==null)
				responPool[key]=new data();
		}
		
		public function getPacketClass(key:uint):IDataPacket
		{
			if(responPool[key])
			{
				var _ins:IDataPacket=IDataPacket(responPool[key]);
				_ins=new ReceivedPacket();
				return _ins;
			}
			return null
		}
	}
}